package nowCoder;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;

/**
 * @Auther: zzx
 * @Date: 2024.03.24/3/10
 */
public class HJ102 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String next = sc.next();
        int[][] is = new int[36][2];
        for (int i = 0; i < next.length(); i++) {
            char c = next.charAt(i);
            for (int j = 0; j < is.length; j++) {
                if (c == is[j][0]){
                    ++is[j][1];
                    break;
                }else if (is[j][0] == 0){
                    is[j][0] = c;
                    is[j][1] = 1;
                    break;
                }
            }
        }
        for (int i = 0; i < is.length; i++) {
            for (int j = i + 1; j < is.length; j++) {
                if (is[i][1] < is[j][1]){
                    int[] temp = is[i];
                    is[i] = is[j];
                    is[j] = temp;
                }else if(is[i][1] == is[j][1] && is[i][0] > is[j][0]){
                    int[] temp = is[i];
                    is[i] = is[j];
                    is[j] = temp;
                }
            }
        }
        for (int[] ints : is) {
            if (ints[0] != 0)
                System.out.print((char) ints[0]);
        }
        System.out.println();
    }
}
